package com.his.his_system.controller.DataStatisticsController;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.his.his_system.domain.DzmHisCareOrderSub;
import com.his.his_system.domain.DzmHisCarePkg;
import com.his.his_system.service.DzmHisCareOrderSubService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 药品销售信息统计
 */
@RestController
@RequestMapping("DrugSales")
public class DrugSalesController {

      @Resource
      private DzmHisCareOrderSubService dzmHisCareOrderSubService;


      private static final  int PAGE_SIZE =5;

      /**
       *
       * @param pageSize
       * @return
       * 查询药品信息  （分页）
       */
      @GetMapping("drugInfo")
      PageInfo<DzmHisCareOrderSub> drugInfo(Integer pageSize){

            PageHelper.startPage(pageSize,PAGE_SIZE );
            PageInfo<DzmHisCareOrderSub> page = new PageInfo<DzmHisCareOrderSub>(dzmHisCareOrderSubService.drugInfo());

            return page;
      }


      /**
       * @return
       * 药品名称模糊擦查询
       */
      @GetMapping("drugQueryInfo")
      PageInfo<DzmHisCareOrderSub> query(String drugName) {

            System.out.println(drugName);

            PageHelper.startPage(1,PAGE_SIZE );
            PageInfo<DzmHisCareOrderSub> page = new PageInfo<DzmHisCareOrderSub>(dzmHisCareOrderSubService.drugQuery(drugName));


            return page;
      }

      /**
       * 销售总数和销售总额统计
       */
      @GetMapping("statistics")
      List<DzmHisCareOrderSub> statistics(){

             return  dzmHisCareOrderSubService.drugInfo();
      }


}
